﻿/*
 * ©2009-2011 XELF
 * http://xelf.info
 */

using System;
using System.Diagnostics;

namespace XELF.Framework {
	public struct GCCheck {
		long pre;
		long? allocatedBytes;

		public long? AllocatedBytes { get { return allocatedBytes; } }

		[Conditional("DEBUG")]
		public void Begin() {
			pre = GC.GetTotalMemory(true);
		}
		[Conditional("DEBUG")]
		public void End() {
			long post = GC.GetTotalMemory(true);
			allocatedBytes = post - pre;
		}
		public void ForceBegin() {
			pre = GC.GetTotalMemory(true);
		}
		public void ForceEnd() {
			long post = GC.GetTotalMemory(true);
			allocatedBytes = post - pre;
		}
	}
}
